package services

import (
	"ShopSupplierApi/models"
	"time"
)

//OrderServer 订单操作服务层
type OrderServer struct{}

//OrderServ 订单操作服务对象
var OrderServ *OrderServer

func init() {
	OrderServ = &OrderServer{}
}

//OrderList 供应商获取订单列表
//Param supplierID uint64 供应商ID
//Param t   OrderType   订单类型
//Param starttime   int64 开始时间戳
//Param endtime int64 结束时间戳
func (*OrderServer) OrderList(supplierID uint64, t models.OrderType, starttime int64, endtime int64, p *models.Page) []models.Order {
	return models.Orders.OrderList(supplierID, t, starttime, endtime, p)
}

//OrderItem 获取订单商品信息
//Param supplierID uint64 供应商ID
//Param orderID uint64 订单号
func (*OrderServer) OrderItem(supplierID uint64, orderID uint64) []models.OrderProduct {
	return models.Orders.OrderItem(supplierID, orderID)
}

//OrderInfo 获取订单详情
//Param supplierID uint64 供应商ID
//Param orderID uint64 订单号
func (*OrderServer) OrderInfo(supplierID uint64, orderID uint64) (*models.OrderInfo, error) {
	return models.Orders.OrderInfo(supplierID, orderID)
}

//ProductOrders 商品订单列表
//Param supplierID uint64 供应商ID
//Param ProductID uint64 货品ID
//Param p *Page 数据分页信息
func (*OrderServer) ProductOrders(supplierID uint64, productID uint64, p *models.Page) []models.Order {
	return models.Orders.ProductOrders(supplierID, productID, p)
}

//OrderCount 订单统计
//Param supplierID uint64 供应商ID
//Param timeType models.OrderTimeType 订单统计时间类型
//Param dataType models.OrderDataType 数据类型
//Param t time.Time 统计时间
func (*OrderServer) OrderCount(supplierID uint64, timeType models.OrderTimeType, dataType models.OrderDataType, t time.Time) map[string]map[string]uint {
	return models.Orders.OrderCount(supplierID, timeType, dataType, t)
}

//OrderTimeCount 下单时间段统计
//Param supplierID uint64 供应商ID
//Param timeType models.OrderTimeType 订单统计时间类型
//Param t time.Time 统计时间
func (*OrderServer) OrderTimeCount(supplierID uint64, timeType models.OrderTimeType, t time.Time) map[string]uint {
	return models.Orders.OrderTimeCount(supplierID, timeType, t)
}

//OrderMemberCount 订单会员数据统计
//Param supplierID uint64 供应商ID
//Param timeType models.OrderTimeType 订单统计时间类型
//Param t time.Time 统计时间
func (*OrderServer) OrderMemberCount(supplierID uint64, timeType models.OrderTimeType, t time.Time) map[string]map[string]uint {
	return models.Orders.OrderMemberCount(supplierID, timeType, t)
}

//OrderLocalCount 订单地区统计
//Param supplierID uint64 供应商ID
//Param timeType models.OrderTimeType 订单统计时间类型
//Param t time.Time 统计时间
func (*OrderServer) OrderLocalCount(supplierID uint64, timeType models.OrderTimeType, t time.Time) map[string]map[string]uint {
	return models.Orders.OrderLocalCount(supplierID, timeType, t)
}
